package com.lexc.watermq.broker.utils;

import java.io.BufferedReader;
import java.io.FileReader;

/**
 * createTime：2025-08-19 10:04
 * description：简化版本的文件读取工具
 */
public class FileContentReaderUtil {

    /**
     * 读取文件的内容
     *
     * @param path 文件的路径
     * @return 读取的内容
     */
    public static String readFile(String path) {
        try (BufferedReader br = new BufferedReader(new FileReader(path))) {
            StringBuilder strLine = new StringBuilder();
            while (br.ready()) {
                String s = br.readLine();
                strLine.append(s);
            }
            return strLine.toString();

        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    public static void main(String[] args) {
        String path="D:\\L.Info\\L.Application\\waterMQ\\waterMQ\\broker\\config\\watermq-topic.json";
        System.out.println(FileContentReaderUtil.readFile(path));
    }
}
